package practise.alogrithm.hundredInterviewQuestions.secondTime;

/**
 * Created by Richard on 7/26/2014.
 */
public class StringPermutation {

    public void printStrigPermutation(char[] str, int index){
        if(index==str.length){
            System.out.println(str);
            return;
        }
        for(int i=index;i<str.length;i++){
            char temp = str[i];
            str[i] = str[index];
            str[index] = temp;

            printStrigPermutation(str,index+1);

            str[index] = str[i];
            str[i] = temp;

        }
    }

    public static void main(String[] args){
        new StringPermutation().printStrigPermutation("abc".toCharArray(),0);
    }
}
